home *** CD-ROM | disk | FTP | other *** search
/ Dr. Windows 3 / dr win3.zip / dr win3 / PROGRAMR / RTX2000.ZIP / rtx2000 / monitor / gp < prev    next >
Text File  |  1992-11-01  |  958b  |  55 lines

  1. ( ********************* MODULE GP  ********************************* 
  2.     General purpose FORTH words
  3. )
  4.  
  5.  
  6. xlink
  7. : 0= ( x -- x )
  8. ( return TRUE if zero, FALSE otherwise )
  9.    if
  10.      FALSE
  11.   else
  12.      TRUE
  13.   then
  14. ;
  15.  
  16.  
  17. xlink
  18. : rot ( z y x -- y x z )
  19. ( Stardard FORTH rot function )
  20.    >r swap r> swap
  21. ;
  22.  
  23. xlink
  24. : -rot ( z y x -- x z y )
  25. ( Rotate the other direction )
  26.    swap >r swap r>
  27. ;
  28.  
  29. : rotate_right ( x -- y )
  30. ( y = right rotate(x) )
  31.   dup c2/ drop           ( put lsb into carry bit )
  32.   c2/                    ( rotate carry into msb )
  33. ;
  34.  
  35. : u>= ( x y -- f )
  36. ( f = TRUE if x greater or equal to y, with x, y unsigned )
  37.     - c2/ 0<
  38. ;
  39.  
  40. : u<  ( x y -- f )
  41. ( f = TRUE if x less then y, with x, y unsigned )
  42.   u>= not
  43. ;
  44.  
  45. : u>  ( x y -- f )
  46. ( f = TRUE if x greater then y, with x, y unsigned )
  47.   swap u>= not
  48. ;
  49.  
  50. : u<=  ( x y -- f )
  51. ( f = TRUE if x less then or equal to y, with x, y unsigned )
  52.   swap u>=
  53. ;
  54.  
  55.